namespace Chaliy.Syndication.UnitTests.MediaRss
{
	using System;
	using System.Xml.XPath;
	using Xunit;
    using XunitExt;
	using Chaliy.Syndication.MediaRss;

    public class When_Write_Media_Thumbnail
	{        
		[Fact]
        public void Thumbnail_Should_Write_Url()
		{
            const string etalonContentUrl = "http://example.com/media.jpeg";

            MediaThumbnail thumbnail
                = new MediaThumbnail
			{
                Url = new Uri(etalonContentUrl)
			};

            thumbnail
                .ShouldMatchMedia("/media:thumbnail/@url", "Media Thumbnail SHOULD have URL attribute")
                .Value.ShouldEqual(etalonContentUrl);
		}

        [Fact]
        public void Serializer_Should_Throw_SerializationException_If_URL_Not_Defined()
        {
            MediaThumbnail thumbnail
                = new MediaThumbnail();

            thumbnail.ShouldThrowSerializationException();
        }
	}
}
